<?php

/**
 * calendrier form base class.
 *
 * @method calendrier getObject() Returns the current form's model object
 *
 * @package    gesp
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasecalendrierForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cal_id'          => new sfWidgetFormInputHidden(),
      'cal_prj_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('projet'), 'add_empty' => false)),
      'cal_date'        => new sfWidgetFormDate(),
      'cal_heure_debut' => new sfWidgetFormTime(),
      'cal_heure_fin'   => new sfWidgetFormTime(),
      'cal_libelle'     => new sfWidgetFormInputText(),
      'cal_description' => new sfWidgetFormTextarea(),
      'cal_calpln_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('planning'), 'add_empty' => true)),
      'cal_alerte'      => new sfWidgetFormInputCheckbox(),
      'cal_actif'       => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'cal_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('cal_id')), 'empty_value' => $this->getObject()->get('cal_id'), 'required' => false)),
      'cal_prj_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('projet'))),
      'cal_date'        => new sfValidatorDate(array('required' => false)),
      'cal_heure_debut' => new sfValidatorTime(array('required' => false)),
      'cal_heure_fin'   => new sfValidatorTime(array('required' => false)),
      'cal_libelle'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'cal_description' => new sfValidatorString(array('max_length' => 1024, 'required' => false)),
      'cal_calpln_id'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('planning'), 'required' => false)),
      'cal_alerte'      => new sfValidatorBoolean(array('required' => false)),
      'cal_actif'       => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('calendrier[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'calendrier';
  }

}
